<?php
class Core_Model_Geolocationdecision implements Core_Model_Mainable{
    
    private $zip_validator;
    private $action_handler;
    
    public function __construct() {
        $this->zip_validator = new Core_Controller_Zipvalidation;
    }
    
    public function main(array $variables = null) {
        //var_dump($variables);
        //die();
        if($this->zip_validator->main($variables) == TRUE){
            //var_dump($variables);
            //die();
           return $this->add_postal_code_data($variables);
        }
        else {
            //var_dump($variables);
            //die();
          return $this->add_city_data($variables);
        }
    }
    
    private function add_postal_code_data(array $variables = null){
        //var_dump($variables);
        //die();
        $this->action_handler = new Core_Data_Zipcodedata;
        if($this->action_handler->main($variables) != NULL){
            return $this->action_handler->main($variables);
        }
        else {
            
        }
    }
    
    private function add_city_data(array $variables = null){
        $this->action_handler = new Core_Data_Citydata;
        if($this->action_handler->main($variables) != NULL){
            return $this->action_handler->main($variables);
        }
        else {
            
        }
    }

}
